home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol039 / things.bas < prev    next >
Encoding:
BASIC Source File  |  1987-01-11  |  6.3 KB  |  173 lines

  1. 10 REM THINGS -- A data program for things to remember
  2. 20 WIDTH 80
  3. 25 REM Copyright Richard Boucher 1982
  4. 30 CLS: COLOR 0,7: LOCATE 5,20: PRINT "  THINGS a Basic Program to Remember  ":
  5. 40 LOCATE 10,30: PRINT "  By Richard Boucher   11/15/82  "
  6. 50 COLOR 7,0:
  7. 55 LOCATE 20,20: PRINT "Press any key to begin"
  8. 56 GO$ = INKEY$: IF GO$ = "" THEN 56
  9. 57 CLS
  10. 60 REM If you want to use several files place "Input file$" here.
  11. 70 REM and eliminate the next line.
  12. 80 FILE$ = "Things.dat"
  13. 90 OPEN FILE$ AS #1 LEN=80
  14. 100 FIELD #1, 1 AS N$, 14 AS A$, 65 AS B$
  15. 110 CLS:PRINT "Program called Things.bas":
  16. 120 GOSUB 1140   'Subroutine to find last entry
  17. 130 PRINT "Your options are:"
  18. 140 PRINT: PRINT ,"(R) - READ an entry in the file":
  19. 150 PRINT ,"(A) - ADD an item to the file":
  20. 160 PRINT ,"(L) - LIST all the things ":
  21. 170 PRINT: PRINT ,"(E) - ELIMINATE an entry you're finished with":
  22. 180 PRINT ,"(I) - List an INDEX of key words in the file":
  23. 190 PRINT,"(F) - FIND an entry by key word":
  24. 200 PRINT :PRINT, "(P) - PRINT out entries from the file "
  25. 210 PRINT, "(S) - Start a new file or blank out an old one
  26. 220 PRINT ,"(Q) - QUIT": PRINT:
  27. 230 PRINT "What do you want to do ?  ";
  28. 240 X$ = INKEY$: IF X$ = "" THEN 240
  29. 250 PRINT X$
  30. 260 IF X$="S" OR X$="s" THEN 1010
  31. 270 IF X$="r" OR X$="R" THEN 360
  32. 280 IF X$="a" OR X$="A" THEN 520
  33. 290 IF X$="e" OR X$="E" THEN 1290
  34. 300 IF X$="L" OR X$="l" THEN 660
  35. 310 IF X$="I" OR X$ = "i" THEN 1390
  36. 320 IF X$="P" OR X$="p" THEN 1210
  37. 330 IF X$="f" OR X$="F" THEN 850
  38. 340 IF X$="Q" OR X$="q" THEN 1130
  39. 350 CLS:PRINT:PRINT "Bad choice, try again": GOTO 130
  40. 360 CLS 'Section to read entries one by one
  41. 370 GOSUB 1150
  42. 380 PRINT:INPUT "Entry number"; Z
  43. 390 PR$ = "" : INPUT "Do you want to print this ";PR$
  44. 400 IF Z>50 THEN PRINT "Too high": GOTO 380
  45. 410 GET #1, Z
  46. 420 PRINT:PRINT "Key word: ";A$
  47. 430 PRINT "Thing : "; B$
  48. 440 IF PR$ = "Y" OR PR$ = "y" THEN LPRINT A$, B$: LPRINT:
  49. 450 PRINT:PRINT:PRINT:PRINT:
  50. 460 PRINT "(R)ead another entry or (E)dit this one or (G)o back to the main menu ":
  51. 470 GO$ = INKEY$ : IF GO$ = "" THEN 470
  52. 480 IF GO$="R" OR GO$="r" THEN CLS: GOTO 380
  53. 490 IF GO$ = "E" OR GO$ = "e" THEN GOSUB 1530: CLS: GOTO 460
  54. 500 CLS
  55. 510 GOTO 110
  56. 520 REM Section to add entries to the file
  57. 530 CLS: GOSUB 1140
  58. 540 PRINT: INPUT "Item number";M
  59. 550 GET #1,M
  60. 560 IF ASC(N$)<>255 THEN INPUT "Overwrite old entry";O$:IF O$<>"Y" AND O$<>"y" THEN 520
  61. 570 LSET N$ = CHR$(0)
  62. 580 PRINT "Key word";:LOCATE ,23:PRINT CHR$(124):LOCATE ,9:INPUT D$
  63. 590 LSET A$=D$
  64. 600 ON ERROR GOTO 0
  65. 610 PRINT "Thing        ";:LOCATE ,79:PRINT CHR$(124);:LOCATE ,15:INPUT T$
  66. 620 LSET B$=T$
  67. 630 PUT #1,M
  68. 640 PRINT: PRINT "Another entry (Y/N)";
  69. 645 GO$ = INKEY$: IF GO$ = "" THEN 645
  70. 650 PRINT GO$:IF GO$="Y" OR GO$="y" THEN 520 ELSE CLS: GOTO 110
  71. 660 REM Section to list the entries
  72. 670 CLS:
  73. 680 FOR I = 1 TO 46 STEP 5
  74. 690 Q = I: GOSUB 800
  75. 700 Q = I+1: GOSUB 800
  76. 710 Q = I + 2: GOSUB 800
  77. 720 Q = I + 3: GOSUB 800
  78. 730 Q = I + 4: GOSUB 800
  79. 740 PRINT: PRINT:PRINT "Press any key to continue"
  80. 750 K$=INKEY$: IF K$="" THEN 750
  81. 760 NEXT I
  82. 770 PRINT : PRINT "Press any key to go back to main menu"
  83. 780 K$=INKEY$: IF K$="" THEN 780
  84. 790 CLS:GOTO 110
  85. 800 GET #1, Q: IF ASC(N$) = 255 AND ASC(A$) = 0 AND ASC(B$) = 0 THEN 770                       ELSE IF ASC(N$) = 255 THEN RETURN
  86. 810 PRINT: PRINT "Entry number: " Q;
  87. 820 PRINT ,,"Key word: ";A$
  88. 830 PRINT "Thing : ";B$
  89. 840 RETURN
  90. 850 REM Section to write things by key word
  91. 860 CLS
  92. 870 PRINT: INPUT "What is the key word";S$
  93. 880 INPUT "Do you want to print this out";PR$
  94. 890 IF LEN(S$)<3 THEN T = LEN(S$) ELSE T = 3
  95. 900 FOR J=1 TO 50
  96. 910 GET #1,J
  97. 920 IF N$=CHR$(255) AND ASC(A$) = 0 THEN 980
  98. 930 FOR G = 1 TO 8 : LS$ = LEFT$(S$,T): IF LS$ = MID$(A$,G,T) THEN 950
  99. 940 NEXT G: GOTO 970
  100. 950 PRINT: PRINT J,A$,B$
  101. 960 IF PR$="Y" OR PR$="y" THEN LPRINT CHR$(18); J;A$;B$
  102. 970 NEXT J
  103. 980 PRINT: PRINT "Press any key to continue"
  104. 990 K$=INKEY$: IF K$="" THEN 990 ELSE CLS: GOTO 110
  105. 1000 REM Section to initialize a new file
  106. 1010 CLS: PRINT :PRINT "You are about the initialize a whole file":
  107. 1020 PRINT: PRINT: INPUT "Are you sure you want to do this ";SUR$
  108. 1030 IF SUR$ <> "Y" AND SUR$ <>"y" THEN GOTO 110
  109. 1040 PRINT: PRINT: INPUT "What should the name be";FILE$
  110. 1050 CLOSE #1
  111. 1060 OPEN FILE$ AS #1 LEN=80
  112. 1070 FIELD#1, 1 AS N$, 14 AS A$, 65 AS B$
  113. 1080 LSET N$=CHR$(255)
  114. 1090 FOR I=1 TO 50
  115. 1100 PUT #1, I
  116. 1110 NEXT I
  117. 1120 CLS: GOTO 120
  118. 1130 CLOSE #1: PRINT:PRINT:PRINT ,,"Bye-bye Baby":PRINT:PRINT,,,"BYE-BYE":END
  119. 1140 REM Subroutine to find the first blank entry
  120. 1150 FOR I=1 TO 50
  121. 1160 GET #1, I
  122. 1170 IF N$=CHR$(255) THEN 1190
  123. 1180 NEXT I
  124. 1190 PRINT: PRINT,;:COLOR 0,7:PRINT " First blank entry is number"; I:COLOR 7,0
  125. 1200 PRINT: RETURN
  126. 1210 PRINT: INPUT "Number of the first entry, number of last";U,V
  127. 1220 INPUT "Single (s) or double space (d)";SP$
  128. 1230 FOR K=U TO V
  129. 1240 GET #1, K
  130. 1250 IF SP$="d" OR SP$="D" THEN LPRINT
  131. 1260 LPRINT CHR$(18);A$;B$;
  132. 1270 NEXT K
  133. 1280 CLS: GOTO 110
  134. 1290 REM Section to eliminate old entries in field N$
  135. 1300 CLS: GOSUB 1140
  136. 1310 PRINT:PRINT:INPUT "Which entry number";N
  137. 1320 GET #1, N
  138. 1330 PRINT: PRINT N,A$,B$: PRINT: PRINT:
  139. 1340 INPUT "Is this the entry which you're finished with (Y/N)";GO$
  140. 1350 IF GO$="Y" OR GO$="y" THEN LSET N$=CHR$(255):LSET A$ = " "
  141. 1360 PUT #1, N
  142. 1370 CLS: PRINT: INPUT "Finished another entry ";GO$
  143. 1380 IF GO$="y" OR GO$="Y" THEN 1310 ELSE CLS: GOTO 110
  144. 1390 REM Subroutine to list the key words
  145. 1400 CLS
  146. 1410 PRINT "Item","Key Word",,"Item","Key word":PRINT:
  147. 1420 FOR I = 1 TO 49 STEP 2
  148. 1430 GET #1, I
  149. 1440 IF N$=CHR$(255) THEN 1460
  150. 1450 PRINT I,A$;
  151. 1460 GET #1, I+1
  152. 1470 IF N$=CHR$(255) THEN 1490
  153. 1480 PRINT ,I+1,A$
  154. 1490 NEXT I
  155. 1500 PRINT: PRINT:PRINT "Press any key to return to main menu"
  156. 1510 GO$ = INKEY$:IF GO$="" THEN 1510
  157. 1520 GOTO 110
  158. 1530 CLS: PRINT "Editing entry number ";Z:PRINT,, "PRESS ENTER TO RETAIN THE PRESENT ENTRY":
  159. 1540 PRINT ,, "Or, enter changes after going to the end of the line": PRINT:PRINT:
  160. 1550 PRINT "Key word: ";A$
  161. 1560 X = CSRLIN -1
  162. 1570 LOCATE X,10
  163. 1580 INPUT "",TEMP$
  164. 1590 IF TEMP$ <> "" THEN LSET A$ = TEMP$
  165. 1600 LOCATE X+2,1: TEMP$ = ""
  166. 1610 PRINT "Thing: " ; B$
  167. 1620 X = CSRLIN - 1
  168. 1630 LOCATE X,8
  169. 1640 INPUT "",TEMP$
  170. 1650 IF TEMP$<>"" THEN LSET B$ = TEMP$
  171. 1660 PUT #1, Z
  172. 1670 PRINT:PRINT:PRINT: RETURN
  173.